<!DOCTYPE html>
<html>
<head>
<style>
#head_container {
	position: fixed;
	top: 0;
	right: 0;
	height: 88px;
	left: 0;
	background-color: #8D1919;
	font-family: Impact;
	color: #E6CCCC;
	font-size: 68px;
	font-style: bold;
}

#head_text {
	position: fixed;
	left: 5%;
}

#head_line {
	position: fixed;
	top: 88px;
	right: 0;
	height: 5px;
	left: 0;
	background-color: #A64D4D;
}

#content {
	background-color: #E6CCCC;
	position: fixed;
	top: 93px;
	right: 0;
	bottom: 0;
	left: 0;
}

#barchart_content {
	position: absolute;
	top: 3.5%;
	height: 80%;
	width: 65%;
	left: 2%;
	border-radius: 10px;
	border: 10px solid #C08080;
	background-color: white;
}

#contols {
	position: absolute;
	top: 3.5%;
	height: 42%;
	width: 25%;
	left: 71%;
	border-radius: 10px;
	border: 10px solid #C08080;
	background-color: #FFFFCC;
}

#pulse {
	position: absolute;
	top: 50.5%;
	height: 33%;
	width: 25%;
	left: 71%;
		border-radius: 00px;
	border: 10px solid rgba(0, 0, 0, 0);
	background-color: #FFFFCC;
}

#foot_container {
	position: absolute;
	height: 5%;
	right: 0;
	bottom: 0;
	left: 0;
	background-color: #A64D4D
}

#left_ctrl_text {
	position: absolute;
	top: 0;
	right: 40%;
	width: 50%;
	bottom: 0;
	font-family: Impact;
	color: #8D1919;
	font-size: 18px;
}

#right_ctrl_values {
	position: absolute;
	position: absolute;
	top: 0;
	left: 60%;
	width: 40%;
	bottom: 0;
}

.onoffswitch {
	position: relative;
	width: 90px;
}

.onoffswitch-checkbox {
	display: none;
}

.onoffswitch-label {
	display: block;
	overflow: hidden;
	cursor: pointer;
	border: 2px solid #999999;
	border-radius: 20px;
}

.onoffswitch-inner {
	display: block;
	width: 200%;
	margin-left: -100%;
	transition: margin 0.3s ease-in 0s;
}

.onoffswitch-inner:before,.onoffswitch-inner:after {
	display: block;
	float: left;
	width: 50%;
	height: 30px;
	padding: 0;
	line-height: 30px;
	font-size: 14px;
	color: white;
	font-family: Trebuchet, Arial, sans-serif;
	font-weight: bold;
	box-sizing: border-box;
}

.onoffswitch-inner:before {
	content: "START";
	padding-left: 10px;
	background-color: #8D1919;
	color: #FFFFFF;
}

.onoffswitch-inner:after {
	content: "STOP";
	padding-right: 10px;
	background-color: #EEEEEE;
	color: #999999;
	text-align: right;
}

.onoffswitch-switch {
	display: block;
	width: 18px;
	margin: 6px;
	background: #FFFFFF;
	border: 2px solid #999999;
	border-radius: 20px;
	position: absolute;
	top: 0;
	bottom: 0;
	right: 56px;
	transition: all 0.3s ease-in 0s;
}

.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-inner {
	margin-left: 0;
}

.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-switch {
	right: 0px;
}
</style>
</head>
<body>

<div id="head_container">
<div id="head_text">P U R G E &nbsp&nbsp&nbsp A D M I N</div>
</div>
<div id="head_line"></div>
<div id="content">

<div id="barchart_content">
<canvas id="barchart_content_canv"></canvas>
</div>
<div id="contols">
<div id="left_ctrl_text"><br>
PurgeProcess</div>
<div id="right_ctrl_values"><br>
<div class="onoffswitch"><input type="checkbox" name="onoffswitch"
	class="onoffswitch-checkbox" id="myonoffswitch" onclick="start_proc()"
	checked> <label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span>
</label></div>
</div>
</div>
<div id="pulse">
<canvas id="pulse_canv"></canvas>

</div>

<div id="foot_container"></div>
</div>

<script>
	  
      window.requestAnimFrame = (function(callback) {
        return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
        function(callback) {
          window.setTimeout(callback, 1000 / 60);
        };
      })();
	  
      var canvas = document.getElementById('barchart_content_canv');
      var context = canvas.getContext('2d');

  // Make it visually fill the positioned parent
  canvas.style.width ='100%';
  canvas.style.height='100%';
  // ...then set the internal size to match
  canvas.width  = canvas.offsetWidth;
  canvas.height = canvas.offsetHeight;
	  
      var canvas1 = document.getElementById('pulse_canv');
      var context1 = canvas.getContext('2d');

  // Make it visually fill the positioned parent
  canvas1.style.width ='100%';
  canvas1.style.height='100%';
  // ...then set the internal size to match
  canvas1.width  = canvas.offsetWidth;
  canvas1.height = canvas.offsetHeight;
	  
	  var bar1_x = canvas.width*0.1;
	  var bar1_y = canvas.height*0.2;
	  var bar1_width = canvas.width*0.1;
	  var bar1_height = canvas.height*0.85-canvas.height*0.2;
	
	  var bar2_x = canvas.width*0.1;
	  var bar2_y = canvas.height*0.2;
	  var bar2_width = canvas.width*0.1;
	  var bar2_height = canvas.height*0.85-canvas.height*0.2;
	
	  /*
      context.rect(0, 0, canvas.width, canvas.height);

      // create radial gradient
      var grd = context.createRadialGradient(238, 50, 10, 238, 50, 300);
      // light blue
      grd.addColorStop(0, '#A64D4D');
      // dark blue
      grd.addColorStop(1, '#FFFFCC');

      context.fillStyle = grd;
      context.fill();*/
	  
	  
	        context.rect(0, 0, canvas.width, canvas.height);

      // add linear gradient
      var grd = context.createLinearGradient(0, 0, canvas.width, canvas.height);
      // light blue
      grd.addColorStop(0, '#FFFFCC');   
      // dark blue
      grd.addColorStop(1, '#A64D4D');
      context.fillStyle = grd;
      context.fill();
	  
	  context.beginPath();
      context.moveTo(0, canvas.height*0.85);
      context.lineTo(canvas.width, canvas.height*0.85);
	  context.strokeStyle = '#000000';
	  context.lineWidth = 1;
	  context.stroke();
	  
      context.beginPath();
      context.rect(bar1_x, bar1_y, bar1_width, bar1_height);
      context.fillStyle = 'rgba(255,127,0,0.5)';
      context.fill();
      /*context.lineWidth = 1;
      context.strokeStyle = '#ffffff';
      context.stroke();*/
      context.beginPath();
      context.rect(bar2_x, bar2_y, bar2_width, bar2_height);
      context.fillStyle = 'rgba(255,127,0,0.8)';
      context.fill();	


      context.beginPath();
      context.rect(bar1_x*7, bar1_y, bar1_width, bar1_height);
      context.fillStyle = 'rgba(0,127,255,0.5)';
      context.fill();

	  
      context.beginPath();
      context.rect(bar2_x*7, bar2_y, bar2_width, 0);
      context.fillStyle = 'rgba(0,127,255,0.8)';
      context.fill();

      context.font = '24pt Calibri';
      context.fillStyle = 'rgba(255,127,0,1)';
      context.fillText('INACTIVE TRNS in MAIN (100%)', canvas.width*0.05, canvas.height*0.1);

      context.font = '24pt Calibri';
      context.fillStyle = 'rgba(0,127,255,1)';
      context.fillText('INACTIVE TRNS in HIS(0%)', canvas.width*0.55, canvas.height*0.1);
	  
	    function animate(canvas, context, startTime, bar1_x, bar1_y, bar1_width,bar1_height, bar2_x, bar2_y, bar2_width,bar2_height) {
        // update
        var time = (new Date()).getTime() - startTime;

        var linearSpeed = 100;
        // pixels / second
        var newX = linearSpeed * time / 1000;

       

        // clear
        //context.clearRect(0, 0, canvas.width, canvas.height);

	        context.rect(0, 0, canvas.width, canvas.height);

      // add linear gradient
      var grd = context.createLinearGradient(0, 0, canvas.width, canvas.height);
      // light blue
      grd.addColorStop(0, '#FFFFCC');   
      // dark blue
      grd.addColorStop(1, '#A64D4D');
      context.fillStyle = grd;
      context.fill();
	  
	  
	  context.beginPath();
      context.moveTo(0, canvas.height*0.85);
      context.lineTo(canvas.width, canvas.height*0.85);
	  context.strokeStyle = '#000000';
	  context.lineWidth = 1;
	  context.stroke();
	  
      context.beginPath();
      context.rect(bar1_x, bar1_y, bar1_width, bar1_height);
      context.fillStyle = 'rgba(255,127,0,0.5)';
      context.fill();
      /*context.lineWidth = 1;
      context.strokeStyle = '#ffffff';
      context.stroke();*/
      context.beginPath();
      context.rect(bar2_x, bar2_y, bar2_width, bar2_height);
      context.fillStyle = 'rgba(255,127,0,0.8)';
      context.fill();	  

      context.beginPath();
      context.rect(bar1_x*7, bar1_y, bar1_width, bar1_height);
      context.fillStyle = 'rgba(0,127,255,0.5)';
      context.fill();

	  
      context.beginPath();
      context.rect(bar2_x*7, bar1_y+bar2_height, bar2_width, bar1_height-bar2_height);
      context.fillStyle = 'rgba(0,127,255,0.8)';
      context.fill();

      context.font = '24pt Calibri';
      context.fillStyle = 'rgba(255,127,0,1)';
      context.fillText('INACTIVE TRNS in MAIN ('.concat(Math.round(bar2_height*100/bar1_height)).concat('%)'), canvas.width*0.05, canvas.height*0.1);

      context.font = '24pt Calibri';
      context.fillStyle = 'rgba(0,127,255,1)';
      context.fillText('INACTIVE TRNS in HIS('.concat(100-Math.round(bar2_height*100/bar1_height)).concat('%)'), canvas.width*0.55, canvas.height*0.1);
	  
	    if (bar2_height > 0 )
        // request new frame
        requestAnimFrame(function() {
          animate(canvas, context, startTime, bar1_x, bar1_y, bar1_width,bar1_height, bar2_x, bar2_y+0.01*bar2_height, bar2_width,bar2_height-0.01*bar2_height);
        });
      }
	  function start_proc(){
	        // wait one second before starting animation
      setTimeout(function() {
        var startTime = (new Date()).getTime();
        animate( canvas, context, startTime,bar1_x, bar1_y, bar1_width,bar1_height, bar2_x, bar2_y, bar2_width,bar2_height);
      }, 1000);
	  }
    </script>

</body>
</html>
